<!DOCTYPE html>
<#assign f = JspTaglibs["http://www.casic304.cn/f"] />
<#assign SourceDept = JspTaglibs["http://www.casic304.cn/SourceDept"]/>
<html>
<head>
    <meta charset="utf-8">
    <title>课题评审会信息列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
</head>

<body class="listBody">
<div class="qbdms-list">
    <div class="layui-table-view-body">
        <table id="wQbdTecTopicreviewTable" lay-filter="wQbdTecTopicreviewTable"></table>
    </div>
</div>
<!-- 列表头部工具栏 -->
<script type="text/html" id="wQbdTecTopicreviewHeaderToolsBar">
    <div class="ccpui-enterSel">
        <div class="layui-btn-container">
            <a class="layui-btn layui-btn-sm fillBtn" lay-event="add">
                <span>新增</span>
            </a>
            <a class="layui-btn layui-btn-sm" lay-event="delete">
                <span>删除</span>
            </a>
            <a class="layui-btn layui-btn-sm" lay-event="export">
                <span>导出</span>
            </a>
            <!--<a class="layui-btn layui-btn-sm" lay-event="import">
                <i class="layui-icon layui-icon-download-circle"></i>
                <span>导入</span>
            </a>-->
            <@f.a alias="ktpshxx_sban2,ktpshxx_sban3" event="report" css="layui-btn layui-btn-sm">
                <span>上报</span>
            </@f.a>
        </div>
        <form class="layui-form" action="" lay-filter="wQbdTecTopicreviewQueryForm">
            <div class="layui-form-body selch">
                <div class="table-top-filter layui-row">
                    <@SourceDept.dept css="layui-input filter-value"/>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">课题名称</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input filter-value" name="Q_fTopicname_SL" placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">会议名称</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input filter-value" name="Q_fMeetingname_SL" placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">会议地点</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input filter-value" name="Q_fMeetingaddress_SL" placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">组织人</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input filter-value" name="Q_fOrganizingman_SL" placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">参会单位</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input filter-value" name="Q_fChdw_SL" placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">会议开始时间</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input start_time1 filter-value" name="Q_beginfMeetingdate_DL" placeholder="请输入" readonly/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">会议结束时间</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input end_time1 filter-value" name="Q_endfMeetingdate_DE" placeholder="请输入" readonly/>
                        </div>
                    </div>
                </div>
                <div class="selchBtn">
                    <a class="layui-btn layui-btn-sm fillBtn" lay-event="query">
                        <span>查询</span>
                    </a>
                    <div class="layui-btn-group">
                        <button type="button" class="layui-btn layui-btn-sm" lay-event="clears" style="width: 28px;font-size: 12px;padding: 0">
                            <i class="iconfont data-iconcommon_refresh"></i>
                        </button>
                        <button type="button" class="layui-btn layui-btn-sm screenParent" lay-event="screen" style="width: 28px;font-size: 12px;padding: 0">
                            <i class="iconfont data-iconcommon_downarrow screen"></i>
                        </button>
                    </div>
                </div>
            </div>
        </form>
    </div>

</script>
<!-- 右侧工具栏 -->
<script type="text/html" id="wQbdTecTopicreviewRightToolsBar">
    {{# if('${currentUserId}'==d.createBy && d.allowEdit){}}
    <a class="RightBtn" lay-event="edit">编辑</a>
    {{#  } }}
    <a class="RightBtn" lay-event="particulars">详情</a>
    {{# if('${currentUserId}'==d.createBy && d.allowDel){ }}
    <a class="RightBtn" lay-event="del">删除</a>
    {{#  } }}

</script>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>
    //一般直接写在一个js文件中
    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table', 'form', 'common', 'publicMethods', 'jquery', 'layer','propsHandle'], function () {
        var table = layui.table;
        var form = layui.form;
        var common = layui.common;
        var publicMethods = layui.publicMethods;
        var $ = layui.jquery;
        var layer = layui.layer;
        var propsHandle = layui.propsHandle;
        var defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                selectorBtn: '.selectorBtn'
            },
            temQuery = new propsHandle();  // 实例化模板功能部分
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });
        common.tableSort('wQbdTecTopicreviewTable');

        var tableH = publicMethods.tabHeight();

        var currentSystemLevel = "${currentSystemLevel}";
        var commonCols = [{type: 'checkbox', fixed: 'left'}, {field: 'sn', type: 'numbers', title: '序号', fixed: 'left'},
            {field: 'fMeetingname', title: '会议名称', sort: false, sortname: 'f_meetingname', minWidth: '120'}
            , {
                field: 'fMeetingdate', title: '会议时间', sort: false, sortname: 'f_meetingdate', minWidth: '120', templet: function (d) {
                    return publicMethods.timeData(d.fMeetingdate);
                }
            }
            , {field: 'fMeetingaddress', title: '会议地点', sort: false, sortname: 'f_meetingaddress', minWidth: '120'}
            , {field: 'fOrganizingman', title: '组织人', sort: false, sortname: 'f_organizingman', minWidth: '120'}
            , {field: 'fChdw', title: '参会单位', sort: false, sortname: 'f_chdw', minWidth: '120'}
            , {field: 'fConferencepersonnel', title: '会务人员及联系方式', sort: false, sortname: 'f_conferencepersonnel', minWidth: '260'}];
        var hideCols = [
            {field: 'secret', title: '密级', sort: false, sortname: 'f_secret', hide: true, minWidth: '80'}
            , {field: 'fTopicname', title: '课题名称', sort: false, sortname: 'f_topicname', hide: true, minWidth: '120'}
            , {field: 'fMeetingnotice', title: '会议通知', sort: false, sortname: 'f_meetingnotice', hide: true, minWidth: '120'}
            , {field: 'fMeetingnoticefile', title: '会议通知附件', sort: false, sortname: 'f_meetingnoticefile', hide: true, minWidth: '150'}
            , {field: 'fMeetingmanual', title: '会议手册', sort: false, sortname: 'f_meetingmanual', hide: true, minWidth: '120'}
            , {field: 'fMeetingmanualfile', title: '会议手册附件', sort: false, sortname: 'f_meetingmanualfile', hide: true, minWidth: '150'}
            , {field: 'fMeetingsummary', title: '会议纪要', sort: false, sortname: 'f_meetingsummary', hide: true, minWidth: '120'}
            , {field: 'fMeetingsummaryfile', title: '会议纪要附件', sort: false, sortname: 'f_meetingsummaryfile', hide: true, minWidth: '120'}
        ];
        var manageCols = [{
            minWidth: 200,
            fixed: 'right',
            title: '管理',
            toolbar: '#wQbdTecTopicreviewRightToolsBar'
        }];
        var diyCols = [];
        if ("GROUPLEVEL" !== currentSystemLevel) {
            diyCols = [{
                field: 'reportStatusStr', title: '状态', sort: true, minWidth: '200', sortname: 'REPORT_STATUS', templet: function (d) {
                    return common.stateType(d);
                }
            }];
        }
        var totalCols = [];
        totalCols = totalCols.concat(commonCols).concat(hideCols).concat(diyCols).concat(manageCols);


        //第一个实例
        table.render({
            elem: '#wQbdTecTopicreviewTable'
            , height: tableH
            , url: serverPath.qbdmsPath + '/qbdms/wQbdTecTopicreview/list'
            , page: publicMethods.pageFun()
            , limit: 20
            , defaultToolbar: ['']
            , toolbar: '#wQbdTecTopicreviewHeaderToolsBar'
            , method: 'post'
            , autoSort: false //是否排序
            , cols: [totalCols], done: function () {
                common.tableSelectCon('.ccpui-enterSel .layui-form input', 'a[lay-event=query]', '.ccpui-enterSel');
            }
            , parseData: function (res) { //res 即为原始返回的数据
                common.parseDataList(res, ['fOrganizingman', 'fChdw', 'fConferencepersonnel', 'secret', 'fTopicname', 'fMeetingnotice', 'fMeetingnoticefile'
                    , 'fMeetingmanual', 'fMeetingmanualfile', 'fMeetingsummary', 'fMeetingsummaryfile']);
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.count, //解析数据长度
                    "data": res.data //解析数据列表
                };
            }
        });

        dateReflash()
        //list页面初始化展开按钮tips展示（展开按钮类名）
        publicMethods.tipsAuto('.screen')
        //筛选条件初始化（页面表格的Id，是否初始化（true、false））
        common.initScreenTop('wQbdTecTopicreviewTable', true);

        function dateReflash() {
            publicMethods.reflashDate({startName: '.start_time1', endName: '.end_time1'});
            publicMethods.reflashDate({startName: '.start_time2', endName: '.end_time2'});
            publicMethods.reflashDate({startName: '.start_time3', endName: '.end_time3'});
        }

        function reflashQuery(isClear) {
            common.tableConditionRender("wQbdTecTopicreviewTable", "wQbdTecTopicreviewQueryForm", {where: {}}, isClear, false, 20);
        }

        //监听排序事件
        table.on('sort(wQbdTecTopicreviewTable)', function () {
            reflashQuery(false);
        });

        table.on('toolbar(wQbdTecTopicreviewTable)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id);
            var data = checkStatus.data;
            var _this = this;
            switch (obj.event) {
                case 'add':
                    window.location.href = serverPath.qbdmsPath + "/qbdms/wQbdTecTopicreview/view/add";
                    break;
                case 'delete':
                    var array = "";
                    for (var i = 0; i < data.length; i++) {
                        array += data[i].id + ",";
                    }
                    delFun(data, array);
                    break;
                case 'export':
                    if (data.length == 0) {
                        layer.confirm(publicMethods.confirmStyle('还没有选择，是否导出全部?'), {title: false, skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            var url = serverPath.qbdmsPath + '/qbdms/wQbdTecTopicreview/exportData';
                            var param = "";
                            $("form[lay-filter='wQbdTecTopicreviewQueryForm']").find(".filter-value").each(function (i, value) {
                                param += "&" + this.name + "=" + this.value
                            });
                            open(url, param);
                        });
                    } else {
                        layer.confirm(publicMethods.confirmStyle('确定导出吗?'), {title: false, skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            var ids = [];
                            for (var i = 0; i < data.length; i++) {
                                ids.push(data[i].id);
                            }
                            var url = serverPath.qbdmsPath + '/qbdms/wQbdTecTopicreview/exportData';
                            open(url, "&id=" + ids);
                        });
                    }
                    break;
                case "import":
                    common.importInit('wQbdTecTopicreviewTable', "/qbdms/wQbdTecTopicreview/importData", false, "");
                    dateReflash();
                    break;
                case "query":
                    reflashQuery(false);
                    dateReflash();
                    break;
                case "clears":
                    reflashQuery(true);
                    dateReflash();
                    break;
                case "screen":
                    common.initScreenTop('wQbdTecTopicreviewTable');
                    dateReflash();
                    form.render();
                    break;
                case "report":
                    var array = "";
                    for (var i = 0; i < data.length; i++) {
                        array += data[i].id + ",";
                    }
                    //业务表名,勾选数据主键,流程key,table标签lay-filter属性值,form标签lay-filter属性值,是否允许重复上报,页面所在包名,流程定义id
                    common.report("w_qbd_tec_topicreview", array, "plantToHospital", "wQbdTecTopicreviewTable", "wQbdTecTopicreviewQueryForm", false, "wQbdTecTopicreview", "plantToHospital:1:72d05d40362249118c5453aa60c6da90");
                    dateReflash();
                    break;
            }
            ;
        });

        table.on('tool(wQbdTecTopicreviewTable)', function (obj) {
            var data = obj.data, //获得当前行数据
                layEvent = obj.event; //获得 lay-event 对应的值
            switch (layEvent) {
                case "edit":
                    window.location.href = serverPath.qbdmsPath + '/qbdms/wQbdTecTopicreview/view/add?id=' + data.id
                    break;
                case "particulars":
                    window.location.href = serverPath.qbdmsPath + '/qbdms/wQbdTecTopicreview/view/particulars?id=' + data.id;
                    break;
                case "del":
                    delFun(data, data.id);
                    break;
                case "run":
                    layer.confirm("确定启动该条信息吗?", function (index) {
                        layer.close(index);
                        var nowData = {
                            "id": data.id,
                            "fillman": data.fillman,
                            "fillmanaccount": data.fillmanaccount,
                            "filldept": data.filldept,
                            "filldeptid": data.filldeptid,
                            "filldepthospital": data.filldepthospital,
                            "filldepthospitalid": data.filldepthospitalid,
                            "filldate": data.filldate,
                            "secret": data.secret,
                            "fTopicname": data.fTopicname,
                            "fMeetingname": data.fMeetingname,
                            "fMeetingdate": data.fMeetingdate,
                            "fMeetingaddress": data.fMeetingaddress,
                            "fOrganizingman": data.fOrganizingman,
                            "fChdw": data.fChdw,
                            "fConferencepersonnel": data.fConferencepersonnel,
                            "fMeetingnotice": data.fMeetingnotice,
                            "fMeetingnoticefile": data.fMeetingnoticefile,
                            "fMeetingmanual": data.fMeetingmanual,
                            "fMeetingmanualfile": data.fMeetingmanualfile,
                            "fMeetingsummary": data.fMeetingsummary,
                            "fMeetingsummaryfile": data.fMeetingsummaryfile,
                            "reportStatusTemp": data.reportStatusTemp,
                            "reportStatus": data.reportStatus,
                            "reportReason": data.reportReason,
                            "returnmsg": data.returnmsg,
                            "belongdeptname": data.belongdeptname,
                            "createTime": data.createTime,
                            "createBy": data.createBy,
                            "updateTime": data.updateTime,
                            "updateBy": data.updateBy,
                            "tenantId": data.tenantId
                        };
                        $.ajax({
                            url: serverPath.qbdmsPath + "/qbdms/wQbdTecTopicreview/run",
                            type: "post",
                            data: JSON.stringify(nowData),
                            dataType: 'json',
                            contentType: 'application/json',
                            success: function (data) {
                                layer.alert(data.msg);
                                //执行重载
                                reflashQuery(true);
                                dateReflash();
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                layer.alert(data.msg);
                                //执行重载
                                reflashQuery(true);
                                dateReflash();
                            }
                        })
                    })
                    break;
            }
        });

        function delFun(data, id) {
            if (data.length === 0) {
                layer.confirm(publicMethods.confirmStyle("请先选择一行数据!"), {title: false, skin: 'confirm-class'});
            } else {
                layer.confirm(publicMethods.confirmStyle('确定删除当前数据吗?'), {title: false, skin: 'confirm-class'}, function (index) {
                    layer.close(index);
                    $.ajax({
                        url: serverPath.qbdmsPath + "/qbdms/wQbdTecTopicreview/del",
                        type: "post",
                        data: {id: id},
                        dataType: 'json',
                        success: function (data) {
                            layer.confirm(publicMethods.confirmStyle(data.msg), {title: false, skin: 'confirm-class'});
                            //执行重载
                            reflashQuery(true);
                            dateReflash();
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            layer.confirm(publicMethods.confirmStyle(data.msg), {title: false, skin: 'confirm-class'});
                            //执行重载
                            reflashQuery(true);
                            dateReflash();
                        }
                    })
                })
            }
        }

        window.Initialization = function () {
            reflashQuery(false);
            dateReflash();
        };
        /*刷新时间控件*/
        dateReflash();
        common.tableSort("wQbdTecTopicreviewTable");

        function open(url, param) {
            var curUrl = url;
            layer.open({
                type: 2,
                area: ['700px', '520px'],
                title: ['自定义导出', 'font-size:14px;'],
                content: serverPath.qbdmsPath + '/qbdms/wQbdTecTopicreview/view/export',
                btnAlign: 'c',
                skin: 'qbdms-layerFormBtn',
                btn: ['确定', '取消'],
                yes: function (index, layero) {
                    url = curUrl;
                    var iframeWin = window["layui-layer-iframe" + index];
                    var data = iframeWin.getData();
                    if (data) {
                        url = url + "?data=" + JSON.stringify(data) + param;
                        window.location.href = encodeURI(url)
                    }
                }
            });
        }
    });
</script>
</body>
</html>